/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package com.thingsgrid.notice.repository;

import com.alibaba.fastjson.JSONObject;
import org.springframework.data.mongodb.core.query.Criteria;

import java.util.List;
import java.util.Map;

/**
 * 服务类
 *
 * @author MQ
 */
public interface ICommonRepository{
    /**
     * 根据字段更新
     * @param class1
     * @param queryName
     * @param queryVal
     * @param updateName
     * @param updateKey
     * @return
     */
    boolean updateByName(Class class1, String queryName, String queryVal, String updateName, String updateKey);

    /**
     * 根据key和val批量更新
     * @param class1
     * @param queryName
     * @param queryVals
     * @param updateVals
     * @return
     */
    boolean updateBatch(Class class1, String queryName, List<String> queryVals, List<JSONObject> updateVals);

    /**
     * 根据map批量更新
     * @param class1
     * @param queryName
     * @param queryVal
     * @param map
     * @return
     */
    boolean updateBatch(Class class1, String queryName, String queryVal, Map map);

    /**
     * 批量更新
     * @param class1
     * @param queryName
     * @param queryVals
     * @param updateName
     * @param updateVal
     * @return
     */
    boolean updateBatch(Class class1, String queryName, List<String> queryVals, String updateName,String updateVal);

    /**
     * 批量删除
     * @param class1
     * @param ids
     * @param name
     * @return
     */
    boolean batchDeleteByName(Class class1,List<String> ids,String name);

    /**
     * 模糊查询
     * @param t
     * @param querynName
     * @param queryVal
     * @param <T>
     * @return
     */
    <T>List<T> queryLikeByName(T t, String querynName, String queryVal);

    /**
     * 模糊查询
     * @param t
     * @param criatira
     * @param <T>
     * @return
     */
    <T>List<T> queryLikeByName(T t, Criteria criatira);

    /**
     * 根据key查询
     * @param t
     * @param queryName
     * @param queryVals
     * @param <T>
     * @return
     */
    <T>List<T> queryByNames(T t,String queryName,List<String> queryVals);

    /**
     * 根据key查询
     * @param t
     * @param queryName
     * @param queryVal
     * @param <T>
     * @return
     */
    <T>List<T> queryByName(T t,String queryName ,String queryVal);
}


